package com.xiaolun;

public class Test {

    static  void test(int a) throws MyException {
        System.out.println("传递的参数为："+ a);

        if (a > 10){
            throw new MyException(a); //抛出
        }
        System.out.println("没有异常，正常执行。");
    }

    public static void main(String[] args) {
        try {
            test(12);
        } catch (MyException e) { //e=自定义异常中的输出信息："MyException出现"+ detail
            System.out.println("测试类中异常"+e);
        }
    }
}
